﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DataAccess;

namespace QUANLYKHACHSAN_N4
{
    public partial class frmThemSuaThietBi : DevComponents.DotNetBar.Office2007Form
    {
        public frmThemSuaThietBi()
        {
            InitializeComponent();
            cbThietBi.DataSource = ThietBi_info.GetAll().Tables[0];
            cbThietBi.DisplayMember = cbThietBi.ValueMember = "tentb";
        }
        public string tentb = "";
        public string tenlp = ""; 
        public bool status=false;
        private void btnOK_Click(object sender, EventArgs e)
        {
            try
            {
                if (tentb == "") 
                {
                    if (ChiTietThietBi_Info.Add(tenlp, cbThietBi.Text,int.Parse(txtSoLuong.Text)))
                    {
                        status = true;
                        Close();
                    }
                    return;
                }

                if (ChiTietThietBi_Info.Update(tenlp, cbThietBi.Text, int.Parse(txtSoLuong.Text)))
                {
                    status = true;
                    Close();
                }
                return;
            }
            catch
            {
                BatLoi.ThongBao("nhap sai du lieu vui long kiem tra");
            }
            
        }
        
    }
}
